找传奇、传世资源到传世资源站!

EMGUCV 视觉跟踪

8.5玩家评分(1人评分)
下载后可评
介绍 评论 失效链接反馈



using System;using System.Collections.Generic;using System.Linq;using System.Text;using System.Threading.Tasks;using System.Drawing;using Emgu.CV;using Emgu.CV.CvEnum;using Emgu.CV.UI;using Emgu.CV.Structure;using Emgu.CV.Util;namespace test1{ class Program { static void Main(string[] args) { VideoCapture cap = new VideoCapture("test7.mp4"); if (cap.IsOpened) { int i = 0; Mat frame = new Mat(); while (true) { cap.Read(frame);//读取一帧 if (!frame.IsEmpty) { i ; string imgPath = "./" i.ToString() ".bmp"; CvInvoke.Imwrite(imgPath, frame); Image<Bgr, Byte> image = new Image<Bgr, byte>(imgPath); #region use MCvObjectDetection.Rect MCvObjectDetection[] regions; using (HOGDescriptor des = new HOGDescriptor()) { des.SetSVMDetector(HOGDescriptor.GetDefaultPeopleDetector()); regions = des.DetectMultiScale(image); } foreach (MCvObjectDetection pedestrain in regions) image.Draw(pedestrain.Rect, new Bgr(Color.Lime), 2); CvInvoke.Imshow("image", image); #endregion if (CvInvoke.WaitKey(10) == 27)//esc退出 { break; } } else { Console.WriteLine("帧为空"); break; } } } else { Console.WriteLine("视频打开错误"); return; } } }}

评论

发表评论必须先登陆, 您可以 登陆 或者 注册新账号 !


在线咨询: 问题反馈
客服QQ:174666394

有问题请留言,看到后及时答复